<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/9/23 0023
 * Time: 16:15
 */

namespace App\Models;


class Cart extends Model
{
    protected $table       = 'yf_cart';
    protected $primaryKey  = 'cart_id';
    public $timestamps     = false;

    public static function carts() {
        $user=auth('api')->user();


        var_dump($user);exit;
        if($user && $user->user_id){
            //判断商品库存，商品状态，商品审核，店铺状态。 将无效的商品从购物车中删除
            $cart=self::where([
                ['user_id','=',$user->user_id],
                ['cart_status','=',0]
                ])
                ->orderBy('cart_id')
                ->get();

            var_dump($cart);



        }


    }

}